ImageGear Java PDF
Initialize and Terminate the PDF Library

Before working with PDF documents, the library must be initialized. When finished working with PDF documents, the PDF library must be terminated.

All work with PDF documents should be done between initialization and termination.

Before initialization or after termination any other API calls will fail.

To initialize the PDF library use the initialize method of the PDF class:

 
Copy Code
void initialize();

To terminate the PDF library use the terminate method of the PDF class:

 
Copy Code
void terminate();

The following is an illustration of how to initialize and terminate the PDF library:

 
Copy Code
import com.accusoft.imagegearpdf.*;
        
class PdfDemo
{
        private PDF pdf;

        static
        {
                 // Load ImageGearJavaPDF library.
                 System.loadLibrary("IgPdf");
        }
        
        // Initialize PDF library.
        public void initializePdf()
        {
                 // Create PDF class instance.
                 pdf = PDF.getInstance();
                 
                 // Set runtime license if required.
                 setLicense();
                 
                 // Initialize PDF library.
                 pdf.initialize();
        }
        
        // Terminate PDF library.
        public void teminatePdf()
        {
                if (pdf != null)
                {
                        // Terminate PDF library.
                        pdf.terminate();
                        pdf = null;
                }
         }
         
         // Set runtime license.
         private void setLicense()
         {
                 // Set the name of the organization that purchased the runtime license.
                 pdf.setSolutionName("Accusoft Corporation");
                 
                 // Set identifier of the organization that purchased the runtime license.
                 pdf.setSolutionKey(0x12345678,0x9ABCDEF0,0x87654321,0x0FEDCBA9);
                 
                 // Set OEM license key string, which is a unique identifier of the customer, product,
                 // version, edition, and platforms for which the license is valid.
                 pdf.setOEMLicenseKey("2.0.WE...ff");
          }
}

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback